<template>
  <div class="music-header">
    <hr />
    <div class="top-bar-wrap">
      <div class="top-bar">
        <h1>
          <router-link to="/" style="background-color: #fff">
            <img src="./imgs/logo.png" alt="" />
          </router-link>
        </h1>
        <div class="link-to">
          <router-link to="/">音乐馆</router-link>
        </div>
        <div class="link-to">
          <router-link to="/profile">我的音乐</router-link>
        </div>
        <div class="link-to">
          <a href="#">客户端</a>
        </div>
        <div class="link-to">
          <a href="#">开放平台</a>
        </div>
        <div class="link-to">
          <a href="#">VIP</a>
        </div>
        <div class="link-to search-model">
          <SearchModel />
        </div>
        <div class="link-to">
          <a @click="showLogin = true">登录</a>
        </div>
        <div class="header-cascader1">
          开通VIP
          <el-icon class="caret-bottom">
            <CaretBottom />
          </el-icon>
        </div>
        <div class="header-cascader2" :icon="CaretBottom">
          充值<el-icon class="caret-bottom">
            <CaretBottom />
          </el-icon>
        </div>
      </div>

      <div class="middle-bar">
        <router-link to="/">首页</router-link>
        <router-link to="/singer">歌手</router-link>
        <router-link to="/album">新碟</router-link>
        <router-link to="/toplist">排行榜</router-link>
        <router-link to="/category">分类歌单</router-link>
        <router-link to="/radio">电台</router-link>
        <router-link to="/mv">MV</router-link>
        <router-link to="/digitalalbum">数字专辑</router-link>
      </div>
    </div>
  </div>
  <MusicLogin v-if="showLogin" @closeLogin="showLogin = $event"></MusicLogin>
</template>

<script lang="ts">
export default {
  name: 'MusicHeader',
}
</script>

<script lang="ts" setup>
import MusicLogin from './Login.vue'
import SearchModel from './SearchModel.vue'
import { Search, CaretBottom } from '@element-plus/icons-vue'
import { ref } from 'vue'
const showLogin = ref(false)
</script>

<style scoped>
.music-header {
  min-width: 1200px;
}

.top-bar {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-evenly;
  border-bottom: 1px solid #f2f2f2;
  align-items: center;
  font-size: 18px;
}

.top-bar h1 {
  margin: 0;
}

.top-bar h1 img {
  margin-top: 5px;
}

.link-to a {
  text-decoration: none;
  color: #000;
  display: inline-block;
  line-height: 90px;
  height: 90px;
  padding: 0 20px;
}

.link-to a:hover,
.middle-bar a:hover {
  color: #31c27c;
}

.middle-bar {
  height: 52px;
  line-height: 52px;
  width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.middle-bar a {
  font-size: 15px;
  text-decoration: none;
  color: #000;
  margin: 0 20px;
}

.search-model {
  position: relative;
  color: #565656;
}

.header-cascader1 {
  background-color: #31c27c;
  border: 1px solid #31c27c;
  width: 95px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 13px;
  color: #fff;
  padding: 0 15px 0 10px;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.header-cascader1 .caret-bottom {
  position: absolute;
  right: 6px;
  top: 12px;
}

.header-cascader2 {
  position: relative;
  width: 56px;
  height: 40px;
  font-size: 13px;
  line-height: 40px;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: center;
  padding: 0 15px 0 10px;
}

.header-cascader2:hover {
  background-color: #31c27c;
  border-color: #31c27c;
  color: #fff;
}

.header-cascader2 .caret-bottom {
  position: absolute;
  right: 5px;
  top: 12px;
}
</style>

<style>
.top-bar .router-link-active {
  background-color: #31c27c;
}

.top-bar a.router-link-active {
  color: #fff;
}

.top-bar a.router-link-active:hover {
  color: #fff;
}

.middle-bar a.router-link-exact-active {
  color: #31c27c;
}
</style>
